home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.amiga.programmer
- Path: cs.vu.nl!irmen
- From: irmen@cs.vu.nl (Irmen de Jong)
- Subject: Re: Message port
- Nntp-Posting-Host: sloep63.cs.vu.nl
- References: <708.6632T987T2426@academy.bastad.se>
- Sender: news@cs.vu.nl
- Organization: Dept. of Computer Science, Vrije Universiteit Amsterdam
- Date: Thu, 29 Feb 1996 10:02:29 GMT
- X-Newsreader: TIN [version 1.2 PL2]
- Message-ID: <DnJ7w6.9M7.0.-s@cs.vu.nl>
-
- On 28 Feb 1996 19:39:41 GMT Sten Jansson (sten@academy.bastad.se) (Sten Jansson) wrote:
- : I've tried to create a message-port in a simple test-program. It works,
- : ,but as soon as I start another program the message-port disappear.
- : Here is my program:
- : --
- : void AddportT(struct MsgPort * MP)
-
- If the function must return the freshly created MsgPort, you should use
- void AddportT(struct MsgPort **MP)
- (mind the double *)
- and replace MP in the function by (*MP).
-
-
- : {
- : int SIGBIT;
-
- : if((SIGBIT=AllocSignal(-1L))==-1)
- : exit(0);
-
- : MP= AllocMem(sizeof(struct MsgPort),MEMF_PUBLIC|MEMF_CLEAR);
- : if(!MP)
- : {
- : printf("Kunde inte allockera minne f÷r MsgPort\n");
-
- Sure... ;)
-
- : exit(1);
-
- Don't forget to FreeSignal()!
-
- : }
-
- : MP->mp_Node.ln_Name="WF";
- : MP->mp_Node.ln_Pri=-125;
- : MP->mp_Node.ln_Type=NT_MSGPORT;
-
- : MP->mp_Flags=PA_SIGNAL;
- : MP->mp_SigBit=SIGBIT;
-
- : MP->mp_SigTask=(struct Task*)FindTask(0);
-
- : AddPort(MP);
- : }
- : --
-
- : Please help me if You know what's wrong! Maybe I should use some
- : special compiler directives?
-
- : /Sten
-
-
- You might want to use exec.library/CreateMsgPort and exec.library/DeleteMsgPort.
-
- --
- / Irmen de Jong (email: irmen@cs.vu.nl WWW: http://www.cs.vu.nl/~irmen/) \
- \ ``Nothing lasts forever'' -- Species /
-